#ifndef TSR_H_
#define TSR_H_

#include "recbase.h"
#include "rectype.h"
#include "stdffield.h"
#include <string>
#include <vector>

namespace opsrc {
    namespace stdf
    {
        class Tsr : public opsrc::stdf::RecBase
        {
        public:
            Tsr(stdf_rec stdfrec,  int reclen, std::ios::pos_type fileRecFirstBytePosition, int orderindex, endian e,char* buf);
            virtual ~Tsr();

            const StdfField<int> getHeadNumber() const;
            void setHeadNumber(StdfField<int> headnum);

            const StdfField<int> getSiteNumber() const;
            void setSiteNumber(StdfField<int> sitenum);

            const StdfField<string> getTestType() const;
            void setTestType(StdfField<string> testtyp);

            const StdfField<int> getTestNumber() const;
            void setTestNumber(StdfField<int> testnum);

            const StdfField<long> getExecutionCount() const;
            void setExecutionCount(StdfField<long> execcnt);

            const StdfField<long> getFailureCount() const;
            void setFailureCount(StdfField<long> failcnt);

            const StdfField<long> getAlarmCount() const;
            void setAlarmCount(StdfField<long> alrmcnt);

            const StdfField<string> getTestName() const;
            void setTestName(StdfField<string> testnam);

            const StdfField<string> getSequenceName() const;
            void setSequenceName(StdfField<string> seqnam);

            const StdfField<string> getTestLabel() const;
            void setTestLabel(StdfField<string> testlbl);

            const StdfField<vector<bool> > getOptionFlag() const;
            void setOptionFlag(StdfField<vector<bool> > optflag);

            const StdfField<float> getTestTime() const;
            void setTestTime(StdfField<float> testt);

            const StdfField<float> getLowestTestValue() const;
            void setLowestTestValue(StdfField<float> testmin);

            const StdfField<float> getHighestTestValue() const;
            void setHighestTestValue(StdfField<float> testmax);

            const StdfField<float> getTestResultSumValue() const;
            void setTestResultSumValue(StdfField<float> testsum);

            const StdfField<float> getTestResultSquareValue() const;
            void setTestResultSquareValue(StdfField<float> testsqr);

            void readFields(char *buf);

        protected:
            Tsr();

        private:
            StdfField<int> head_num;
            StdfField<int> site_num;
            StdfField<string> test_typ;
            StdfField<int> test_num;
            StdfField<long> exec_cnt;
            StdfField<long> fail_cnt;
            StdfField<long> alrm_cnt;
            StdfField<string> test_nam;
            StdfField<string> seq_nam;
            StdfField<string> test_lbl;
            StdfField<vector<bool> > opt_flag;
            StdfField<float> test_tim;
            StdfField<float> test_min;
            StdfField<float> test_max;
            StdfField<float> test_sum;
            StdfField<float> test_sqrs;
            endian en;
            bool decodeFields;
        };
        /*
HEAD_NUM U*1 Test head number See note
SITE_NUM U*1 Test site number
TEST_TYP C*1 Test type space
TEST_NUM U*4 Test number
EXEC_CNT U*4 Number of test executions 4,294,967,295
FAIL_CNT U*4 Number of test failures 4,294,967,295
ALRM_CNT U*4 Number of alarmed tests 4,294,967,295
TEST_NAM C*n Test name length byte = 0
SEQ_NAME C*n Sequencer (program segment/flow) name length byte = 0
TEST_LBL C*n Test label or text length byte = 0
OPT_FLAG B*1 Optional data flag See note
TEST_TIM R*4 Average test execution time in seconds OPT_FLAG bit 2 = 1
TEST_MIN R*4 Lowest test result value OPT_FLAG bit 0 = 1
TEST_MAX R*4 Highest test result value OPT_FLAG bit 1 = 1
TST_SUMS R*4 Sumof test result values OPT_FLAG bit 4 = 1
TST_SQRS R*4 Sum of squares of test result

*/
    }	// namespace stdf
}		// namespace opsrc

#endif /*TSR_H_*/
